#This is an R version of a toy simulation to illustrate the Hotelling-Secrist effect #described in Hotelling's 1933 review of H. Secrist's The Triumph of Mediocrity #in Business. See also: M. Friedman, JEL, 1992, and Stigler, Stat. Sci,1996. # For original s version see the directory projects/hotelling n <- 500 s <- 100 m <- 100 g <- n/m rho <- .9 X <- matrix(rnorm(n*s),s) Y <- filter(X,rho,"rec") Y <- Y[51:100,] pdf("fig.1.pdf",width=6.5,height=6) plot(1:50,apply(Y,1,"var"),xlab="time",ylab="variance",type="l") dev.off() Z <- Y[,order(Y[1,])] Z <- array(Z,c(50,m,g)) pdf("fig.2.pdf",width=6.5,height=6) matplot(1:50,apply(Z,c(1,3),"mean"),xlab="time",ylab="group means",type="n") matlines(1:50,apply(Z,c(1,3),"mean")) dev.off() Z <- Y[,order(Y[50,])] Z <- array(Z,c(50,m,g)) pdf("fig.3.pdf",width=6.5,height=6) matplot(1:50,apply(Z,c(1,3),"mean"),xlab="time",ylab="group means",type="n") matlines(1:50,apply(Z,c(1,3),"mean")) dev.off() #This is a second toy simulation to illustrate the Hotelling-Secrist effect #described in Hotelling's 1933 review of H. Secrist's The Triumph of Mediocrity #in Business. See also: M. Friedman, JEL, 1992, and Stigler, Stat. Sci,1996. # like the prior one but now there are different intercepts n <- 500 s <- 100 m <- 100 g <- n/m rho <- .9 X <- matrix(rnorm(n*s),s) Y <- filter(X,rho,"rec") Y <- Y[51:100,]+outer(rep(1,50),rnorm(500)*2) pdf("fig.1.1.pdf",width=6.5,height=6) plot(1:50,apply(Y,1,"var"),xlab="time",ylab="variance",type="l") dev.off() Z <- Y[,order(Y[1,])] Z <- array(Z,c(50,m,g)) pdf("fig.1.2.pdf",width=6.5,height=6) matplot(1:50,apply(Z,c(1,3),"mean"),xlab="time",ylab="group means",type="n") matlines(1:50,apply(Z,c(1,3),"mean")) dev.off() Z <- Y[,order(Y[50,])] Z <- array(Z,c(50,m,g)) pdf("fig.1.3.pdf",width=6.5,height=6) matplot(1:50,apply(Z,c(1,3),"mean"),xlab="time",ylab="group means",type="n") matlines(1:50,apply(Z,c(1,3),"mean")) dev.off()